// pages/profile/score/score.js
import {Request} from '../../../utils/request.js';
import mock from '../../../utils/mock.js';
const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [],
    score: 0,
    totalPage: 0,
    curPage: 1,
    loadingPage: false,
    lastPage: false,
  },

  getData: function(){
    
    let that = this;
    let curPage = that.data.curPage;
    let res = mock.scoreBill;
    that.setData({
      list: that.data.list.concat(res.list),
      totalPage: res.total_page,
      loadingPage: false,
      lastPage: res.total_page == 1 || res.total_page <= curPage,
    });

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getData();
  },


  
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    let that = this;
    if(that.data.curPage == that.data.totalPage || that.data.loadingPage) {
      return ;
    }
    that.setData({
      curPage: that.data.curPage + 1,
      loadingPage: true,
    })
    that.getData();
  },


  onReady: function () {},
  onShow: function () {},
  onHide: function () {},
  onUnload: function () {},
  onPullDownRefresh: function () {},



})